<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组件化思维</title>
</head>

<body>
    <script src="js/vue.js"></script>
    <div id="app">

        {{msg}}
    </div>

    <script>
        //创建构造器对象
        const cpnConstructor = Vue.extend({
        //自定义组件模板：该模板就是html代码中显示的
            temlate:`
            <div>
                <h2>标题</h2>
                <p>第一行内容</p>
                <p>第二行内容</p>
            </div>   
            `
        })

        //第二步：注册组件
        //是将组件构造
        Vue.component('my-cpn'/*第一个参数：组件标签名*/,cpnConstructor/*第二个参数：组件构造器*/)


        var vm = new Vue({
            el: "#app",
            data: {
                msg: 'hello world'
            }
        })
    </script>

</body>

</html>